package lab01;

/**
 * Created by 其 on 2016/4/8.
 */

public class Calculator {
    private double result;
    private boolean flag = true;
    public void add(double a, double b){
        this.result = a + b;
    }
    public void subtract(double a, double b){
        this.result = a - b;
    }
    public void multiply(double a, double b){
        this.result = a * b;
    }
    public void divide(double a, double b){
        if(b != 0)
            this.result = a / b;
        else
            this.flag = false;
    }
    public double getResult(){
        return result;
    }
    public boolean isFlag(){
        return flag;
    }
}
